<template>
  <section class="page">
    <div class="title">{{ this.propsForm.title || "底厂采购单" }}</div>
    <div class="title">订 购 单</div>
    <div class="horizontal-direction">
      <div class="horizontal-box">
        厂 商：<span>{{ this.propsForm.vendName }}</span>
      </div>
      <!-- <div class="horizontal-box">传真：<span></span></div> -->
      <div class="horizontal-box">
        采购单号：<span>{{ this.propsForm.orderNo }}</span>
      </div>
      <div class="horizontal-box">
        季节：<span>{{ this.propsForm.season }}</span>
      </div>
    </div>
    <div class="horizontal-direction">
      <!-- <div class="horizontal-box">负责人：<span></span></div> -->

      <div class="horizontal-box">
        订购日期：<span>{{ this.propsForm.orderNoDate }}</span>
      </div>
      <div class="horizontal-box">
        客户：<span>{{ this.propsForm.custnName }}</span>
      </div>
      <div class="horizontal-box">
        交货地点：<span>{{ this.propsForm.placeName }}</span>
      </div>
    </div>
    <!-- <div class="horizontal-direction">
      <div class="horizontal-box">电 话：<span></span></div>
    </div> -->

    <div>
      <table cellspacing="0" cellpadding="0" border="1" class="el-table__header main-table" style="width: 100%; margin-bottom: 15px">
        <thead class="has-gutter">
          <tr class="text-center">
            <th>序</th>
            <th>材料编码</th>
            <th>材料名称</th>
            <th>单位</th>
            <th>数量</th>
            <!-- <th>单价</th> -->
            <!-- <th>交期</th> -->
            <!-- <th>材料备注</th> -->
          </tr>
        </thead>
        <tbody>
          <template v-for="(item, index) in this.propsForm.detailList || []">
            <tr :key="index">
              <td>{{ item.orderSeq }}</td>
              <td>{{ item.itemNO }}</td>
              <td>{{ item.itemName }}</td>
              <td>{{ item.unit }}</td>
              <td>{{ item.qty }}</td>
              <!-- <td></td> -->
              <!-- <td></td> -->
              <!-- <td></td> -->
            </tr>
          </template>
          <tr>
            <td colspan="3" style="border-right: none"></td>
            <td colspan="1" style="border-right: none; border-left: none; text-align: right">共计:</td>
            <td colspan="1" style="border-left: none; border-right: none; text-align: center">{{ total }}</td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="base-stamp">
      <table cellspacing="0" cellpadding="0" border="0" class="el-table__header table-flow">
        <thead class="has-gutter">
          <tr class="text-left">
            <th><div class="examine-cell">签核角色</div></th>
            <th><div class="examine-cell">审核人员</div></th>
            <th><div class="examine-cell">审核状况</div></th>
            <th><div class="examine-cell">审核意见</div></th>
            <th><div class="examine-cell">审核时间</div></th>
          </tr>
        </thead>
        <tbody>
          <template>
            <tr class="text-left" v-for="(item, index) in propsForm.qhChkmgrdList || []" :key="index">
              <td>
                <div>{{ item.flowDesc }}</div>
              </td>
              <td>
                <div>{{ item.toUserCname }}</div>
              </td>
              <td>
                <div>{{ item.chkStatusName }}</div>
              </td>
              <td>
                <div>{{ item.chkOk }}</div>
              </td>
              <td>
                <div>{{ item.chkDate }}</div>
              </td>
            </tr>
          </template>
        </tbody>
      </table>
    </div>
    <div class="horizontal-direction horizontal-sign">
      <div class="text-left">总经理签核:</div>
      <div class="sign"></div>
    </div>
  </section>
</template>

<script>
module.exports = {
  props: {
    propsForm: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      sessionStorageData: JSON.parse(sessionStorage.parameterData),
      applicationForm: {
        detailList: [],
      },
    };
  },
  mounted() {},
  computed: {
    total() {
      const list = this.propsForm.detailList;
      const total = list.reduce((pre, cur) => {
        pre += +cur.qty;
        return pre;
      }, 0);
      return +total.toFixed(2);
    },
  },
};
</script>

<style>
.horizontal-box {
  margin-bottom: 0.5em;
}
.page {
  margin: auto;
  width: 100%;
  max-width: 297mm;
}
.title {
  margin-bottom: 10px;
  font-size: 20px;
  font-weight: bold;
}
.out-table {
  border-collapse: separate;
  box-sizing: border-box;
}
.out-table th {
  background-color: #b3ffb3;
}
</style>
